﻿//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using Implements;

namespace ConnectionProvider.MainGate {
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace = "http://Core.MainGate",
        ConfigurationName = "MainGate.IMainGate",
        CallbackContract = typeof (ConnectionProvider.MainGate.IMainGateCallback),
        SessionMode = System.ServiceModel.SessionMode.Required)]
    public interface IMainGate {
        [System.ServiceModel.OperationContractAttribute(Action = "http://Core.MainGate/IMainGate/Autentificate",
            ReplyAction = "http://Core.MainGate/IMainGate/AutentificateResponse")]
        bool Autentificate(string login, string password);

        [System.ServiceModel.OperationContractAttribute(Action = "http://Core.MainGate/IMainGate/PushEvent",
            ReplyAction = "http://Core.MainGate/IMainGate/PushEventResponse")]
        void PushEvent(CommonTypes.BaseEvent baseEvent);

        [System.ServiceModel.OperationContractAttribute(Action = "http://Core.MainGate/IMainGate/Subscribe",
            ReplyAction = "http://Core.MainGate/IMainGate/SubscribeResponse")]
        bool Subscribe();

        [System.ServiceModel.OperationContractAttribute(Action = "http://Core.MainGate/IMainGate/Unsubscribe",
            ReplyAction = "http://Core.MainGate/IMainGate/UnsubscribeResponse")]
        bool Unsubscribe();
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface IMainGateCallback {
        [System.ServiceModel.OperationContractAttribute(IsOneWay = true,
            Action = "http://Core.MainGate/IMainGate/OnEvent")]
        void OnEvent(CommonTypes.BaseEvent newEvent);
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface IMainGateChannel : ConnectionProvider.MainGate.IMainGate, System.ServiceModel.IClientChannel {}

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class MainGateClient : System.ServiceModel.DuplexClientBase<ConnectionProvider.MainGate.IMainGate>,
                                          ConnectionProvider.MainGate.IMainGate {
        public MainGateClient(System.ServiceModel.InstanceContext callbackInstance) :
            base(callbackInstance) {}

        public MainGateClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName) :
            base(callbackInstance, endpointConfigurationName) {}

        public MainGateClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName,
                              string remoteAddress) :
                                  base(callbackInstance, endpointConfigurationName, remoteAddress) {}

        public MainGateClient(System.ServiceModel.InstanceContext callbackInstance, string endpointConfigurationName,
                              System.ServiceModel.EndpointAddress remoteAddress) :
                                  base(callbackInstance, endpointConfigurationName, remoteAddress) {}

        public MainGateClient(System.ServiceModel.InstanceContext callbackInstance,
                              System.ServiceModel.Channels.Binding binding,
                              System.ServiceModel.EndpointAddress remoteAddress) :
                                  base(callbackInstance, binding, remoteAddress) {}

        public bool Autentificate(string login, string password) {
            return base.Channel.Autentificate(login, password);
        }

        public void PushEvent(CommonTypes.BaseEvent baseEvent) {
            base.Channel.PushEvent(baseEvent);
        }

        public bool Subscribe() {
            try {
                return base.Channel.Subscribe();
            }
            catch (Exception e) {
                InstantLogger.err("MainGateClient::Subscribe -> {1}: \n{0}", e.Message, e.TargetSite.Name);
                return false;
            }
        }

        public bool Unsubscribe() {
            return base.Channel.Unsubscribe();
        }
                                          }
}